colorbutton: Fix focus
authorMatthias Clasen <mclasen@redhat.com>
Fri, 3 Apr 2020 21:39:49 +0000 (17:39 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 4 Apr 2020 04:28:45 +0000 (00:28 -0400)
The colorbutton contains a button which contains a colorswatch.
We want the focus to go straight to the button, nowhere else,
so mark the swatch as !can-focus.

Adapt tests to match.

gtk/gtkcolorbutton.c
testsuite/gtk/focus-chain/widget-factory.tab

index 1638cdc6ee70706c9bc7795c5c171ed76e19deb5..13dbc36c79740ea30a6c62f287e37021872bc9ac 100644 (file)
@@ -265,6 +265,7 @@ gtk_color_button_init (GtkColorButton *button)
   gtk_widget_set_parent (priv->button, GTK_WIDGET (button));
 
   priv->swatch = gtk_color_swatch_new ();
+  gtk_widget_set_can_focus (priv->swatch, FALSE);
   layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black");
   pango_layout_get_pixel_extents (layout, NULL, &rect);
   g_object_unref (layout);
index 1812f0c8f6e5d649ffb7f831f8f26f69360055de..2a95755abd86dc6697a2115287003ffec67afcf2 100644 (file)
@@ -16,7 +16,6 @@ GtkToggleButton
 GtkToggleButton
 GtkButton
 GtkButton
-GtkColorSwatch
 GtkButton
 GtkLinkButton
 GtkSwitch